class Point {}

class ColorPoint extends Point {
  constructor(x, y, color) {
    super(x, y);
    this.color = color;
  }

  toString() {
    return this.color + ' ' + super.toString();
  }
}

const obj = { aa: 1, bb: 2, cc: 3, dd: 4 };

console.log(obj);

// const { aa, ...abc } = obj;

// console.log(aa);
// console.log(bb);

// const { user, ...otherProps } = { user: 'aa', bb: 123, cc: 456, dd: 789 };

// console.log(user);

// console.log(...otherProps);

// fetch('localhost/data/cityinfo/101010100.html').then(res => console.log(res.json()));

const testFunc = payload => {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      if (payload > 1) {
        resolve(payload);
      } else {
        reject('超时');
      }
    }, 5000);
  });
};

testFunc(0)
  .then(resolve => console.log(`异步的数值${resolve}`))
  .catch(reject => console.log(reject));
